

clear

use "/Users/scottfabramson/Dropbox/Job Market Paper/IO Revisions/Replication_Files/Replication_Main_Text/Table_2/data_table2.dta"



**** Makes Table 2 ***

**** Make sure ivreg2 xtivreg2 and qvf functions are installed *****



ssc install ivreg2
ssc install xtivreg2
ssc install ivpois
findit qvf


tsset ID Year

tabulate Year, g(y)
generate instrument= abs(Temp-10.5)
generate treatment= log(Urban_Pop+.001)





**** Top Panel of Table 2 ****



*** Column 1 ***

ivreg2 Entrants (treatment =instrument), cluster(ID)


eststo a1 







*** Column 2 ***


ivreg2 Entrants y* (treatment =instrument), cluster(ID)


eststo a2 




*** Column 3 ***


ivreg2 Entrants y* X Y (treatment =instrument), cluster(ID)


eststo a3



*** Column 4 ***

xtivreg2 Entrants (treatment =instrument), fe cluster(ID)

eststo a4 



*** Column 5 ***

xtivreg2 Entrants  l.Entrants (treatment =instrument), fe cluster(ID)

eststo a5 



*** Column 6 ***

xtivreg2 Entrants (treatment =instrument), fd cluster(ID)

eststo a6 




***** Produces Top Panel of Table 2 *********

estout a1 a2 a3 a4 a5 a6, cells(b(star fmt(2))  ci(par fmt(2))) style(tex) drop(y* X Y _cons L.Entrants)






*************************First Stage Results (Lower Panel)**************************************






*** Column 1 **** 



*** gives First stage F stat ****

ivreg2 Entrants (treatment =instrument), cluster(ID) ffirst


*** produces the same thing but is storable ***

reg treatment instrument, cluster(ID)

eststo b1 




*** Column 2 **** 


*** gives First stage F stat ****


ivreg2 Entrants y* (treatment =instrument), cluster(ID) ffirst


reg treatment instrument y*, cluster(ID)

eststo b2 




*** Column 3 **** 


*** gives First stage F stat ****

ivreg2 Entrants y* X Y  (treatment =instrument), cluster(ID) ffirst

reg treatment instrument y* X Y, cluster(ID)

eststo b3 



*** Column 4 **** 


*** gives First stage F stat ****


xtivreg2 Entrants (treatment =instrument), fe cluster(ID) ffirst


xtreg treatment instrument, fe cluster(ID) 

eststo b4





*** Column 5 **** 


*** gives First stage F stat ****


xtivreg2 Entrants l.Entrants (treatment =instrument), fe cluster(ID) ffirst


xtreg treatment  l.Entrants instrument, fe cluster(ID) 

eststo b5




*** Column 6 **** 


*** gives First stage F stat ****



xtivreg2 Entrants (treatment =instrument), fd cluster(ID) ffirst


xtivreg2 treatment instrument, fd cluster(ID) 

eststo b6



***** Creates the Lower Panel ****




estout b1 b2 b3 b4 b5 b6, cells(b(star fmt(2))  ci(par fmt(2))) style(tex) drop(y* X Y _cons L.Entrants)







***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** 
***** ***** *****  Reproduces 1st 3 columns w/ Poisson and Negbin Regression and Is not in Main Text But Produces Same Results ***** 
***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** 




***** ***** IV Poisson ***** ***** ***** ***** 


ivpois Entrants, exog(instrument) endog(treatment) 

 

ivpois Entrants y1 y2 y3 y4 y5 y6, exog(instrument) endog(treatment)



ivpois Entrants y1 y2 y3 y4 y5 y6 X Y, exog(instrument) endog(treatment)





***** ***** ***** IV Neg Bin ***** ***** ***** ***** 

qvf Entrants treatment (instrument),  family(nbinomial) cluster(ID) 

qvf Entrants treatment y1 y2 y3 y4 y5 y6 (instrument y1 y2 y3 y4 y5 y6),  family(nbinomial) cluster(ID) 

qvf Entrants treatment y1 y2 y3 y4 y5 y6 X Y (instrument y1 y2 y3 y4 y5 y6 X Y),  family(nbinomial) cluster(ID) 

















